package com.lonely.common.enums;

import com.lonely.common.exception.BusinessException;
import lombok.Getter;

/**
 * @author : 黄志标
 * @date: 2025/10/10 11:42
 * @description: 打印相关枚举
 */
public class PrintEnum {


    @Getter
    public enum PrintType {

        /**
         * 一维码
         */
        ONE_DIMENSIONAL_CODE(1),

        /**
         * 二维码
         */
        QR_CODE(2);

        /**
         * 类型
         */
        private final int type;

        PrintType(int type) {
            this.type = type;
        }

        /**
         * 根据类型获取对应的枚举
         *
         * @param type
         * @return
         */
        public static PrintType getByType(int type) {
            for (PrintType value : PrintType.values()) {
                if (value.getType() == type) {
                    return value;
                }
            }
            throw new BusinessException("打印类型不存在");
        }
    }


}
